<!Doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>结构体变量和结构体类型的定义 | 菜鸟教程</title>

  <meta name='robots' content='max-image-preview:large' />
<link rel='stylesheet' id='classic-theme-styles-css' href='../0/classic-themes.min.css?ver=6.2' type='text/css' media='all' />
<link rel="canonical" href="../w3cnote/structure-variables-and-structure-types.html" />
<meta name="keywords" content="结构体变量和结构体类型的定义">
<meta name="description" content="1.结构体类型定义  定义方式1：  Typedef struct  LNode {    int  data;  // 数据域    struct LNode   *next;  // 指针域 } *LinkList;     定义方式2：  struct  LNode {    int  data;  // 数据域    struct LNode   *next;  // 指针域  }; Typedef struct  LNode ..">
		
	<link rel="shortcut icon" href="https://static.runoob.com/images/favicon.ico">
	<link rel="stylesheet" href="../0/style.css?v=1.170" type="text/css" media="all" />	
	<link rel="stylesheet" href="../0/font-awesome.min.css" media="all" />	
  <!--[if gte IE 9]><!-->
  <script src=""></script>
  <!--<![endif]-->
  <!--[if lt IE 9]>
     <script src=""></script>
     <script src=""></script>
  <![endif]-->
  <link rel="apple-touch-icon" href="https://static.runoob.com/images/icon/mobile-icon.png"/>
  <meta name="apple-mobile-web-app-title" content="菜鸟教程">
</head>
<body>

<!--  头部 -->
<div class="container logo-search">

  <div class="col search row-search-mobile">
    <form action="index.php">
      <input class="placeholder" placeholder="搜索……" name="s" autocomplete="off">
      
    </form>
  </div>

  <div class="row">
    <div class="col logo">
      <h1><a href="../">菜鸟教程 -- 学的不仅是技术，更是梦想！</a></h1>
    </div>
        <div class="col right-list"> 
    <button class="btn btn-responsive-nav btn-inverse" data-toggle="collapse" data-target=".nav-main-collapse" id="pull" style=""> <i class="fa fa-navicon"></i> </button>
    </div>
        
    <div class="col search search-desktop last">
      <div class="search-input" >
      <form action="//www.runoob.com/" target="_blank">
        <input class="placeholder" id="s" name="s" placeholder="搜索……"  autocomplete="off" style="height: 44px;">
      </form>
      
      </div>
    </div>
  </div>
</div>



<!-- 导航栏 -->
<div class="container navigation">
    <div class="row">
        <div class="col nav">
            

                        <ul class="pc-nav" id="note-nav">
                <li><a href="../">首页</a></li>
                <li><a href="../w3cnote">笔记首页</a></li>
                <li><a href="../w3cnote/android-tutorial-intro.html" title="Android 基础入门教程">Android</a></li>
                <li><a href="../w3cnote/es6-tutorial.html" title="ES6 教程">ES6 教程</a></li>
                <li><a href="../w3cnote/ten-sorting-algorithm.html" title="排序算法">排序算法</a></li>
                <li><a href="../w3cnote/hadoop-tutorial.html" title="Hadoop 教程">Hadoop</a></li>
                <li><a href="../w3cnote/zookeeper-tutorial.html" title="Zookeeper 教程">Zookeeper</a></li>
                <li><a href="../w3cnote/verilog-tutorial.html" title="Verilog 教程">Verilog</a></li>
                <li><a href="../w3cnote_genre/code" title="编程技术">编程技术</a></li> 
                <li><a href="../w3cnote_genre/coderlife" title="程序员人生">程序员人生</a></li>
                
                <!--<li><a href="javascript:;" class="runoob-pop">登录</a></li>
                
                
                        <li>
                <a style="font-weight:bold;" href="../linux/linux-tutorial.html#yunserver" target="_blank" onclick="_hmt.push(['_trackEvent', 'aliyun', 'click', 'aliyun'])" title="kkb">云服务器</a>
                </li>
                <li><a href="http://gk.link/a/104mQ" target="_blank" style="font-weight: bold;"onclick="_hmt.push(['_trackEvent', '极客时间', 'click', 'jike'])" title="我的圈子">极客时间</a></li>
            
                
                <li><a target="_blank" href="../shoppinglist" rel="nofollow">知识店铺</a></li> 
        -->
            </ul>
                        
              
            <ul class="mobile-nav">
                <li><a href="../w3cnote">首页</a></li>
                <li><a href="../w3cnote_genre/android" target="_blank" title="Android 基础入门教程">Android</a></li>
                <li><a href="../w3cnote/es6-tutorial.html" target="_blank" title="ES6 教程">ES6</a></li>
                <li><a href="../w3cnote_genre/joke" target="_blank" title="程序员笑话">逗乐</a></li>
                
                <a href="javascript:void(0)" class="search-reveal">Search</a> 
            </ul>
            
        </div>
    </div>
</div>


<!--  内容  -->
<div class="container main">
	<div class="row">

		<div class="col middle-column big-middle-column">
	 			<div class="article">
			<div class="article-heading">
				<h2>结构体变量和结构体类型的定义</h2>				<h3><em>分类</em> <a href="../w3cnote_genre/code" title="编程技术" >编程技术</a> </h3>
			</div>
			<div class="article-body note-body">
				<div class="article-intro">
					
<h3>
1.结构体类型定义
</h3>
<p>定义方式1：</p>

<pre>Typedef struct  LNode {
   int  data;  // 数据域
   struct LNode   *next;  // 指针域
} *LinkList;</pre>

 

<p>定义方式2：</p>

<pre>struct  LNode {
   int  data;  // 数据域
   struct LNode   *next;  // 指针域

};
Typedef struct  LNode  *LinkList;</pre>

<p>以上两个定义方式是等价的，是将 <strong>*LinkList</strong> 定 义为 <strong>struct  LNode</strong> 类型，即 <strong>LinkList</strong> 被定义为一个类型名。这样就可以用 <strong>LinkList</strong> 来定义说明新的变量了，如：</p>

<pre>LinkList  L;</pre>

<p>即将 <strong>L</strong> 定义为 <strong>struct  LNode</strong> 类型的指针变量。</p>

<h3>
2.结构体类型变量定义
</h3>
<p>定义方式1：</p>

<pre>struct  LNode {
   int  data;  // 数据域
   struct LNode   *next;  // 指针域

}LnodeA;</pre>

<p>定义方式2：</p>

<pre>struct  LNode {
   int  data;  // 数据域
   struct LNode   *next;  // 指针域

};
struct  LNode LnodeA;</pre>

<p>以上两个定义方式也是等价的，这样就将 <strong>LnodeA</strong> 定义为一个 <strong>struct  LNode</strong> 类型的变量，即 <strong>LnodeA</strong> 为一个 <strong>struct  LNode</strong> 类型的变量名。</p>


<hr><h2>
结构体内标的定义方式
</h2>
<h3>1.结构体，透明表区，DATA ELEMENT，DOMAIN</h3>

<p>透明表是对一个物理表的逻辑描述，透明表里有许多字段，并且定义某些字段为 PRIMARY KEY，字段里又包含 DATA ELEMENT，用来描述语言属性和技术属性。DATA ELEMENT 中又包含 DOMAIN，它是定义数据类型和字段长度。</p>

<p>结构体一般是用来定义一个结构变量，有临时数据的储存，没有 PRIMARY KEY，结构体里包含 COMPONENT 而不是 FIELD

 </p>
<h3>
2.Internal table 中的属性分为三种 LINE TYPE ，KEY，TABLE KIND。
</h3>
<p>LINE TYPE 在 INTERNAL TABLE 里单独的一行叫 LINE TYPE，每一行的结构都一样。</p>

<p>KEY：相当于数据库里的主键。在排序的时候有用，UNIQUE 或 NON-UNIQUE。</p>

<p>TABLE KIND：分为 STANDARD，SORTED，HASHED。</p>

<h3>
三种类型的内表的定义
</h3>
<p>标准表：</p>

<pre>DATA itab1 TYPE STANDARD TABLE OF scarr WITH NON-UNIQUE KEY carrid.</pre>

<p>排序表：</p>

<pre>DATA itab2 TYPE SORTED TABLE OF scarr WITH NON-UNIQUE KEY carrid.</pre>

<p>哈希表：</p>

<pre>DATA itab3 TYPE HASHED TABLE OF scarr WITH UNIQUE KEY carrid.</pre>
<h3>
一般定义方法（标准表）
</h3>
<p>根据数据库表定义标准表</p>

<pre>DATA itab4 TYPE TABLE OF scarr.</pre>

<p>根据自建的结构变量定义标准表（最常用）</p>

<pre>DATA: BEGIN OF wa,
    carrid TYPE scarr-carrid,
    carrnamen TYPE scarr-carrname,
    END OF wa.
DATA itab5 LIKE TABLE OF wa.</pre>

<p>根据数据字典中的表类型定义标准表</p>

<pre>DATA itab6 TYPE ztabtype00_1.</pre>

<p>根据内表定义内表</p>

<pre>DATA itab7 LIKE itab6.</pre>

<p>根据内表定义结构</p>

<pre>DATA wa1 LIKE LINE OF itab7.</pre>

<p>3. 定义结构的方式</p>

<p>根据数据字典中的表或者结构来定义程序的结构变量(或类型)</p>

<pre>types str1 type spfli.
data str2 type  sflight.</pre>



<p>自定义程序中的结构变量(或类型)－最常见的</p>

<pre>data: begin of wa,
carrid type spfli-carrid,
com(10) type c,
end of wa.</pre>

 

<p>根据内表定义结构</p>

<pre>data wa like line of itab.</pre>

<p><strong>注：</strong>根据数据库表定义的一定是结构</p>

 

<p>同名字段的赋值（重要）</p>

<pre>Move-corresponding A  to  B.</pre>

 

<p>read 是读取内表的一条数据</p>

<pre>read table itab like table of wa.</pre>

<p>读一内表的多条数据应用 loop</p>

<pre>loop at itab into wa.</pre>
<hr><h2>
C/C++ 语言中的解释
</h2>
<p><strong>结构体定义</strong></p>

<p>结构体(struct)是由一系列具有相同类型或不同类型的数据构成的数据集合，也叫结构。</p>

<p><strong>结构体作用</strong></p>

<p>结构体和其他类型基础数据类型一样，例如 int 类型，char 类型 只不过结构体可以做成你想要的数据类型。以方便日后的使用。　</p><p>

在实际项目中，结构体是大量存在的。研发人员常使用结构体来封装一些属性来组成新的类型。　　
</p><p>
结构体在函数中的作用不是简便，其最主要的作用就是封装。封装的好处就是可以再次利用。让使用者不必关心这个是什么，只要根据定义使用就可以了。
</p><p>
<strong>结构体的大小与内存对齐</strong>
</p><p>
结构体的大小不是结构体元素单纯相加就行的，因为我们现在主流的计算机使用的都是 32Bit 字长的 CPU，对这类型的 CPU 取 4 个字节的数要比取一个字节要高效，也更方便。所以在结构体中每个成员的首地址都是4的整数倍的话，取数据元素是就会相对更高效，这就是内存对齐的由来。
</p><p>
每个特定平台上的编译器都有自己的默认"对齐系数"(也叫对齐模数)。程序员可以通过预编译命令 <span class="marked">#pragma pack(n)，n=1,2,4,8,1</span>6 来改变这一系数，其中的n就是你要指定的"对齐系数"。　　</p><p>

<p><strong>规则：</strong></p>　　
<ul><li>
1、数据成员对齐规则：结构(struct)(或联合(union))的数据成员，第一个数据成员放在 offset 为 0 的地方，以后每个数据成员的对齐按照 <span class="marked">#pragma pack</span>指定的数值和这个数据成员自身长度中，比较小的那个进行。　　
</li><li>
2、结构(或联合)的整体对齐规则：在数据成员完成各自对齐之后，结构(或联合)本身也要进行对齐，对齐将按照< span class="marked">#pragma pack</span> 指定的数值和结构(或联合)最大数据成员长度中，比较小的那个进行。　　
</li><li>
3、结合1、2颗推断：当#pragma pack的n值等于或超过所有数据成员长度的时候，这个n值的大小将不产生任何效果。
</li></ul>
<h3>
C++ 中的结构体
</h3>
<p>在 C 语言中，可以定义结构体类型，将多个相关的变量包装成为一个整体使用。在结构体中的变量，可以是相同、部分相同，或完全不同的数据类型。在 C 语言中，结构体不能包含函数。在面向对象的程序设计中，对象具有状态（属性）和行为，状态保存在成员变量中，行为通过成员方法（函数）来实现。C 语言中的结构体只能描述一个对象的状态，不能描述一个对象的行为。在 C++ 中，考虑到 C 语言到 C++ 语言过渡的连续性，对结构体进行了扩展，C++ 的结构体可以包含函数，这样，C++ 的结构体也具有类的功能，与class 不同的是，结构体包含的函数默认为 public，而不是 private。　　</p>

<p>C++ 控制台输出例子：</p>　

<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-prepro">#include</span><span class="hl-prepro"> </span><span class="hl-quotes">&lt;</span><span class="hl-string">cstdlib</span><span class="hl-quotes">&gt;</span><span class="hl-prepro">　</span><span class="hl-prepro"></span><span class="hl-code">
</span><span class="hl-prepro">#include</span><span class="hl-prepro"> </span><span class="hl-quotes">&lt;</span><span class="hl-string">iostream</span><span class="hl-quotes">&gt;</span><span class="hl-prepro">　　//定义结构体　　</span><span class="hl-prepro"></span><span class="hl-code">
</span><span class="hl-reserved">using</span><span class="hl-code"> </span><span class="hl-types">namespace</span><span class="hl-code"> </span><span class="hl-identifier">std</span><span class="hl-code">;　
 
</span><span class="hl-types">struct</span><span class="hl-code"> </span><span class="hl-identifier">point</span><span class="hl-code">　
</span><span class="hl-brackets">{</span><span class="hl-code">　　
    </span><span class="hl-comment">//包含两个变量成员　</span><span class="hl-comment"></span><span class="hl-code">
    </span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">x</span><span class="hl-code">;　　
    </span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">y</span><span class="hl-code">;　
</span><span class="hl-brackets">}</span><span class="hl-code">;　　
 
 
</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">main</span><span class="hl-brackets">(</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">argc</span><span class="hl-code">, </span><span class="hl-types">char</span><span class="hl-code"> *</span><span class="hl-identifier">argv</span><span class="hl-brackets">[</span><span class="hl-brackets">]</span><span class="hl-brackets">)</span><span class="hl-code">　
</span><span class="hl-brackets">{</span><span class="hl-code">　　
    </span><span class="hl-types">struct</span><span class="hl-code"> </span><span class="hl-identifier">point</span><span class="hl-code"> </span><span class="hl-identifier">pt</span><span class="hl-code">;　
    </span><span class="hl-identifier">pt</span><span class="hl-code">.</span><span class="hl-identifier">x</span><span class="hl-code">=</span><span class="hl-number">1</span><span class="hl-code">;　
    </span><span class="hl-identifier">pt</span><span class="hl-code">.</span><span class="hl-identifier">y</span><span class="hl-code">=</span><span class="hl-number">2</span><span class="hl-code">;　
    </span><span class="hl-identifier">cout</span><span class="hl-code">&lt;&lt;</span><span class="hl-identifier">pt</span><span class="hl-code">.</span><span class="hl-identifier">x</span><span class="hl-code">&lt;&lt;</span><span class="hl-identifier">endl</span><span class="hl-code">&lt;&lt;</span><span class="hl-identifier">pt</span><span class="hl-code">.</span><span class="hl-identifier">y</span><span class="hl-code">&lt;&lt;</span><span class="hl-identifier">endl</span><span class="hl-code">;
    </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">EXIT_SUCCESS</span><span class="hl-code">;
</span><span class="hl-brackets">}</span></div>
</div>
</div>
<p><strong>C++中的结构体与类的区别</strong></p>

<p>类与结构体在 C++ 中只有两点区别，除此这外无任何区别。　　</p>
<ul><li>

（1）class 中默认的成员访问权限是 private 的，而 struct 中则是 public 的。　　
</li><li>
（2）从 class 继承默认是 private 继承，而从 struct 继承默认是 public 继承。

</li></ul>
<p><strong>这两种定义有什么区别?</strong></p>

<pre>typedef struct student
{
&nbsp;&nbsp;&nbsp;&nbsp;int num;
&nbsp;&nbsp;&nbsp;&nbsp;struct student *next;
}student;

struct student
{
&nbsp;&nbsp;&nbsp;&nbsp;int num;
&nbsp;&nbsp;&nbsp;&nbsp;struct student *next;
};</pre>

<p>第二个 struct student 是定义了一个 student 结构体，这个明白吧。</p>

<p>第一个是用 typedef 把 struct student 这个结构体类型名字重新定义为 student，也就是说 struct student 和 student 表示同一个事物，都是一个类型的标识符，比如 typedef int zhengshu; 就是你把整型 int 重命名为 zhengshu，下面定义：int i; 和 zhengshu i; 两句就是等价的了。</p>

<p>结构是由基本数据类型构成的、并用一个标识符来命名的各种变量的组合。结构中可以使用不同的数据类型。</p>

<h3>
结构说明和结构变量定义</h3>
<p>在 Turbo C 中，结构也是一种数据类型，可以使用结构变量，因此，象其它类型的变量一样，在使用结构变量时要先对其定义。</p>
<p>定义结构变量的一般格式为: </p>
<pre>struct 结构名
{ 
&nbsp;&nbsp;&nbsp;&nbsp;类型 变量名;
&nbsp;&nbsp;&nbsp;&nbsp;类型 变量名;
...
} 结构变量;</pre>

<p>结构名是结构的标识符不是变量名。</p>
<p>类型为第二节中所讲述的五种数据类型(整型、浮点型、字符型、指针型和无值型)。 </p>
<p>构成结构的每一个类型变量称为结构成员，它象数组的元素一样，但数组中元素是以下标来访问的，而结构是按变量名字来访问成员的。</p>
<p>下面举一个例子来说明怎样定义结构变量。 </p>

<pre>struct string 
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char name[8]; 
&nbsp;&nbsp;&nbsp;&nbsp;int age; 
&nbsp;&nbsp;&nbsp;&nbsp;char sex[4]; 
&nbsp;&nbsp;&nbsp;&nbsp;char depart[20]; 
&nbsp;&nbsp;&nbsp;&nbsp;float wage1,wage2,wage3; 
}person; </pre>

<p>这个例子定义了一个结构名为 string 的结构变量 person，如果省略变量名 person，则变成对结构的说明。用已说明的结构名也可定义结构变量。这样定义时上例变成: </p>

<pre>struct string 
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char name[8]; 
&nbsp;&nbsp;&nbsp;&nbsp;int age; 
&nbsp;&nbsp;&nbsp;&nbsp;char sex[4]; 
&nbsp;&nbsp;&nbsp;&nbsp;char depart[20]; 
&nbsp;&nbsp;&nbsp;&nbsp;float wage1,wage2,wage3; 
}; 
struct string person;</pre>

<p>如果需要定义多个具有相同形式的结构变量时用这种方法比较方便，它先作结构说明，再用结构名来定义变量。</p>
<p>例如:</p>
<pre>struct string Tianyr, Liuqi, ...;</pre> 

<p>如果省略结构名，则称之为无名结构，这种情况常常出现在函数内部，用这种结构时前面的例子变成: </p>

<pre>struct 
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char name[8]; 
&nbsp;&nbsp;&nbsp;&nbsp;int age; 
&nbsp;&nbsp;&nbsp;&nbsp;char sex[4]; 
&nbsp;&nbsp;&nbsp;&nbsp;char depart[20]; 
&nbsp;&nbsp;&nbsp;&nbsp;float wage1,wage2,wage3; 
} Tianyr, Liuqi;</pre> 

<h3>结构变量的使用</h3>
<p>结构是一个新的数据类型，因此结构变量也可以象其它类型的变量一样赋值、运算，不同的是结构变量以成员作为基本变量。</p>
<p>结构成员的表示方式为: </p>

<pre>结构变量.成员名</pre> 

<p>如果将结构变量.成员名看成一个整体，则这个整体的数据类型与结构中该成员的数据类型相同，这样就可象前面所讲的变量那样使用。</p>
<p>下面这个例子定义了一个结构变量，其中每个成员都从键盘接收数据，然后对结构中的浮点数求和，并显示运算结果。请注意这个例子中不同结构成员的访问。 </p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-prepro">#include</span><span class="hl-prepro"> </span><span class="hl-quotes">&lt;</span><span class="hl-string">stdio.h</span><span class="hl-quotes">&gt;</span><span class="hl-prepro"></span><span class="hl-code">
</span><span class="hl-prepro">#include</span><span class="hl-prepro"> </span><span class="hl-quotes">&lt;</span><span class="hl-string">conio.h</span><span class="hl-quotes">&gt;</span><span class="hl-prepro">  </span><span class="hl-prepro"></span><span class="hl-code">
 
</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">main</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> 
</span><span class="hl-brackets">{</span><span class="hl-code"> 
    </span><span class="hl-types">struct</span><span class="hl-code">
    </span><span class="hl-brackets">{</span><span class="hl-code"> 
        </span><span class="hl-types">char</span><span class="hl-code"> </span><span class="hl-identifier">name</span><span class="hl-brackets">[</span><span class="hl-number">8</span><span class="hl-brackets">]</span><span class="hl-code">; 
        </span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">age</span><span class="hl-code">; 
        </span><span class="hl-types">char</span><span class="hl-code"> </span><span class="hl-identifier">sex</span><span class="hl-brackets">[</span><span class="hl-number">4</span><span class="hl-brackets">]</span><span class="hl-code">; 
        </span><span class="hl-types">char</span><span class="hl-code"> </span><span class="hl-identifier">depart</span><span class="hl-brackets">[</span><span class="hl-number">20</span><span class="hl-brackets">]</span><span class="hl-code">; 
        </span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">wage1</span><span class="hl-code">,</span><span class="hl-identifier">wage2</span><span class="hl-code">,</span><span class="hl-identifier">wage3</span><span class="hl-code">; 
    </span><span class="hl-brackets">}</span><span class="hl-identifier">a</span><span class="hl-code">; 
    </span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">wage</span><span class="hl-code">; 
    </span><span class="hl-types">char</span><span class="hl-code"> </span><span class="hl-identifier">c</span><span class="hl-code">='</span><span class="hl-identifier">Y</span><span class="hl-code">'; 
    </span><span class="hl-reserved">while</span><span class="hl-brackets">(</span><span class="hl-identifier">c</span><span class="hl-code">=='</span><span class="hl-identifier">Y</span><span class="hl-code">'||</span><span class="hl-identifier">c</span><span class="hl-code">=='</span><span class="hl-identifier">y</span><span class="hl-code">'</span><span class="hl-brackets">)</span><span class="hl-code"> 
    </span><span class="hl-brackets">{</span><span class="hl-code"> 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-code">\</span><span class="hl-identifier">nName</span><span class="hl-code">:</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">scanf</span><span class="hl-brackets">(</span><span class="hl-code">%</span><span class="hl-identifier">s</span><span class="hl-code">, </span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">name</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">Age</span><span class="hl-code">:</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">scanf</span><span class="hl-brackets">(</span><span class="hl-code">%</span><span class="hl-identifier">d</span><span class="hl-code">, &amp;</span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">wage</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">Sex</span><span class="hl-code">:</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">scanf</span><span class="hl-brackets">(</span><span class="hl-code">%</span><span class="hl-identifier">s</span><span class="hl-code">, </span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">sex</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">Dept</span><span class="hl-code">:</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">scanf</span><span class="hl-brackets">(</span><span class="hl-code">%</span><span class="hl-identifier">s</span><span class="hl-code">, </span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">depart</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">Wage1</span><span class="hl-code">:</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">scanf</span><span class="hl-brackets">(</span><span class="hl-code">%</span><span class="hl-identifier">f</span><span class="hl-code">, &amp;</span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">wage1</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">Wage2</span><span class="hl-code">:</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">scanf</span><span class="hl-brackets">(</span><span class="hl-code">%</span><span class="hl-identifier">f</span><span class="hl-code">, &amp;</span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">wage2</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">Wage3</span><span class="hl-code">:</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">scanf</span><span class="hl-brackets">(</span><span class="hl-code">%</span><span class="hl-identifier">f</span><span class="hl-code">, &amp;</span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">wage3</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">wage</span><span class="hl-code">=</span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">wage1</span><span class="hl-code">+</span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">wage2</span><span class="hl-code">+</span><span class="hl-identifier">a</span><span class="hl-code">.</span><span class="hl-identifier">wage3</span><span class="hl-code">; 
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">The</span><span class="hl-code"> </span><span class="hl-identifier">sum</span><span class="hl-code"> </span><span class="hl-identifier">of</span><span class="hl-code"> </span><span class="hl-identifier">wage</span><span class="hl-code"> </span><span class="hl-identifier">is</span><span class="hl-code"> %</span><span class="hl-number">6</span><span class="hl-number">.2</span><span class="hl-identifier">f</span><span class="hl-code">\</span><span class="hl-identifier">n</span><span class="hl-code">, </span><span class="hl-identifier">wage</span><span class="hl-brackets">)</span><span class="hl-code">;
        </span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-identifier">Continue</span><span class="hl-code">?</span><span class="hl-brackets">)</span><span class="hl-code">; 
        </span><span class="hl-identifier">c</span><span class="hl-code">=</span><span class="hl-identifier">getche</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">; 
    </span><span class="hl-brackets">}</span><span class="hl-code"> 
</span><span class="hl-brackets">}</span></div>
</div>
</div>

<h3>结构数组和结构指针</h3> 
<p>结构是一种新的数据类型， 同样可以有结构数组和结构指针。</p>
<p><strong>1.结构数组 </strong></p>
<p>结构数组就是具有相同结构类型的变量集合。假如要定义一个班级40个同学的姓名、性别、年龄和住址，可以定义成一个结构数组。如下所示:</p>
<pre>struct
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char name[8]; 
&nbsp;&nbsp;&nbsp;&nbsp;char sex[4]; 
&nbsp;&nbsp;&nbsp;&nbsp;int age; 
&nbsp;&nbsp;&nbsp;&nbsp;char addr[40]; 
}student[40];</pre>
<p>也可定义为: </p>
<pre>struct string
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char name[8]; 
&nbsp;&nbsp;&nbsp;&nbsp;char sex[4]; 
&nbsp;&nbsp;&nbsp;&nbsp;int age; 
&nbsp;&nbsp;&nbsp;&nbsp;char addr[40]; 
}; 
struct string student[40];</pre> 
<p>需要指出的是结构数组成员的访问是以数组元素为结构变量的, 其形式为: </p>
<pre>结构数组元素.成员名 </pre>
<p>例如:</p> 
<pre>student[0].name 
student[30].age </pre>
<p>实际上结构数组相当于一个二维构造, 第一维是结构数组元素, 每个元素是一个结构变量, 第二维是结构成员。</p>
<p><strong>注意</strong>: 结构数组的成员也可以是数组变量。</p>
<p>例如:</p> 
<pre>struct a 
{ 
&nbsp;&nbsp;&nbsp;&nbsp;int m[3][5]; 
&nbsp;&nbsp;&nbsp;&nbsp;float f; 
&nbsp;&nbsp;&nbsp;&nbsp;char s[20]; 
}y[4];</pre> 
<p>为了访问结构a中结构变量 <strong>y[2]</strong> 的这个变量, 可写成 <span class="marked">y[2].m[1][4]</span> </p>
<p><strong>2.结构指针 </strong></p>
<p>结构指针是指向结构的指针。它由一个加在结构变量名前的* 操作符来定义, 例如用前面已说明的结构定义一个结构指针如下: </p>
<pre>struct string
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char name[8]; 
&nbsp;&nbsp;&nbsp;&nbsp;char sex[4]; 
&nbsp;&nbsp;&nbsp;&nbsp;int age; 
&nbsp;&nbsp;&nbsp;&nbsp;char addr[40]; 
}*student;</pre>
<p>也可省略结构指针名只作结构说明, 然后再用下面的语句定义结构指针。</p>
<pre>struct string *student; </pre>
<p>使用结构指针对结构成员的访问，与结构变量对结构成员的访问在表达方式上有所不同。结构指针对结构成员的访问表示为:</p>
<pre>结构指针名-&gt;结构成员 </pre>
<p>其中 <span class="marked">-&gt;</span> 是两个符号 <span class="marked">-</span> 和 <span class="marked">&gt;</span> 的组合，好象一个箭头指向结构成员。例如要给上面定义的结构中 name 和 age 赋值，可以用下面语句:</p>
<pre>strcpy(student-&gt;name, Lu G.C); 
student-&gt;age=18;</pre>
<p>实际上，<strong>student-&gt;name</strong> 就是 <strong>(*student).name</strong> 的缩写形式。</p>
<p>需要指出的是结构指针是指向结构的一个指针，即结构中第一个成员的首地址，因此在使用之前应该对结构指针初始化，即分配整个结构长度的字节空间，这可用下面函数完成， 仍以上例来说明如下: </p>
<pre>student=(struct string*)malloc(size of (struct string));</pre>
<p><strong>size of (struct string)</strong> 自动求取 string 结构的字节长度， malloc() 函数定义了一个大小为结构长度的内存区域，然后将其诈地址作为结构指针返回。 </p>

<p><strong>注意: </strong></p>
<ul><li>
1. 结构作为一种数据类型，因此定义的结构变量或结构指针变量同样有局部变量和全程变量，视定义的位置而定。</li><li>
2. 结构变量名不是指向该结构的地址，这与数组名的含义不同，因此若需要求结构中第一个成员的首地址应该是 <span class="marked">&[结构变量名]</span>。</li><li>
3. 结构的复杂形式：嵌套结构 </li></ul>
<p>嵌套结构是指在一个结构成员中可以包括其它一个结构，Turbo C 允许这种嵌套。 </p>
<p>例如: 下面是一个有嵌套的结构 </p>
<pre>struct string
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char name[8]; 
&nbsp;&nbsp;&nbsp;&nbsp;int age; 
&nbsp;&nbsp;&nbsp;&nbsp;struct addr address; 
} student; </pre>
<p>其中: addr 为另一个结构的结构名, 必须要先进行, 说明, 即</p>
<pre>struct addr
{ 
&nbsp;&nbsp;&nbsp;&nbsp;char city[20]; 
&nbsp;&nbsp;&nbsp;&nbsp;unsigned lon zipcode; 
&nbsp;&nbsp;&nbsp;&nbsp;char tel[14]; 
}</pre> 
<p>如果要给 student 结构中成员 address 结构中的 zipcode 赋值, 则可写成:</p>
<pre>student.address.zipcode=200001; </pre>
<p>每个结构成员名从最外层直到最内层逐个被列出,即嵌套式结构成员的表达方式是: </p>
<pre>结构变量名.嵌套结构变量名.结构成员名 </pre>
<p>其中嵌套结构可以有很多，结构成员名为最内层结构中不是结构的成员名。</p>



<blockquote> <p>原文链接：https://www.cnblogs.com/yuxinJ/p/4688496.html</p></blockquote>


				</div>
			</div>
			<div class="previous-next-links">
			<div class="previous-design-link">← <a href="../w3cnote/java-interface-and-polymorphism.html" rel="prev"> Java 接口和多态</a> </div>
			<div class="next-design-link"><a href="../w3cnote/python-append-deepcopy.html" rel="next"> Python append() 与深拷贝、浅拷贝</a> →</div>
			</div>
			<style>
.wrapper {
  /*text-transform: uppercase; */
  background: #ececec;
  color: #555;
  cursor: help;
  font-family: "Gill Sans", Impact, sans-serif;
  font-size: 20px;
  position: relative;
  text-align: center;
  width: 200px;
  -webkit-transform: translateZ(0); /* webkit flicker fix */
  -webkit-font-smoothing: antialiased; /* webkit text rendering fix */
}

.wrapper .tooltip {
  white-space: nowrap;
  font-size: 14px;
  text-align: left;
  background: #96b97d;
  bottom: 100%;
  color: #fff;
  display: block;
  left: -25px;
  margin-bottom: 15px;
  opacity: 0;
  padding: 14px;
  pointer-events: none;
  position: absolute;
  
  -webkit-transform: translateY(10px);
     -moz-transform: translateY(10px);
      -ms-transform: translateY(10px);
       -o-transform: translateY(10px);
          transform: translateY(10px);
  -webkit-transition: all .25s ease-out;
     -moz-transition: all .25s ease-out;
      -ms-transition: all .25s ease-out;
       -o-transition: all .25s ease-out;
          transition: all .25s ease-out;
  -webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
     -moz-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
      -ms-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
       -o-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
          box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
}
.tooltip a {
	color:#fff;
}
/* This bridges the gap so you can mouse into the tooltip without it disappearing */
.wrapper .tooltip:before {
  bottom: -20px;
  content: " ";
  display: block;
  height: 20px;
  left: 0;
  position: absolute;
  width: 100%;
}  

/* CSS Triangles - see Trevor's post */
.wrapper .tooltip:after {
  border-left: solid transparent 10px;
  border-right: solid transparent 10px;
  border-top: solid #96b97d 10px;
  bottom: -10px;
  content: " ";
  height: 0;
  left: 20%;
  margin-left: -13px;
  position: absolute;
  width: 0;
}
.wrapper .tooltip1 {
	margin-left: 50px;
	padding-top: 0px;
}
/*
.wrapper:hover .tooltip {
  opacity: 1;
  pointer-events: auto;
  -webkit-transform: translateY(0px);
     -moz-transform: translateY(0px);
      -ms-transform: translateY(0px);
       -o-transform: translateY(0px);
          transform: translateY(0px);
}
*/
/* IE can just show/hide with no transition */
.lte8 .wrapper .tooltip {
  display: none;
}

.lte8 .wrapper:hover .tooltip {
  display: block;
}

</style>

<link rel="stylesheet" href="../0/upvotejs.css">
<script src=""></script>
<script src=""></script>
<div id="respond" class="no_webshot"> 
		<div class="comment-signarea" style=" padding: 20px 20px;"> 
	<h3 class="text-muted" id="share_code" style="color: #799961;"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> 点我分享笔记</h3>
	<!--
	<p style="font-size:14px;">笔记需要是本篇文章的内容扩展！</p><br>
	<p style="font-size:12px;"><a href="../tougao" target="_blank">文章投稿，可点击这里</a></p>
	<p style="font-size:14px;"><a href="../w3cnote/runoob-user-test-intro.html#invite" target="_blank">注册邀请码获取方式</a></p>
		<h3 class="text-muted"><i class="fa fa-info-circle" aria-hidden="true"></i> 分享笔记前必须<a href="javascript:;" class="runoob-pop">登录</a>！</h3>
		<p><a href="../w3cnote/runoob-user-test-intro.html#invite" target="_blank">注册邀请码获取方式</a></p>-->
	</div>
		
	<form action="/wp-content/themes/runoob/option/addnote.php" method="post" id="commentform" style="display:none;">
		<div class="comt">
			<div class="comt-title">
				<i style="font-size:36px;" class="fa fa-user-circle" aria-hidden="true"></i>				<p><a id="cancel-comment-reply-link" href="javascript:;">取消</a></p>
			</div>
			<div class="comt-box">
			<div id="mded"></div>
			
				<div class="comt-ctrl">
					<div class="comt-tips"><input type='hidden' name='comment_post_ID' value='20404' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
</div>
					<button type="submit" name="submit" id="submit" tabindex="5"><i class="fa fa-pencil" aria-hidden="true"></i> 分享笔记</button>
				</div>
			</div>
		
				
					<div class="comt-comterinfo"> 
						<ul id="comment-author-info">
							<li class="form-inline"><label class="hide" for="author">昵称</label><input class="ipt" type="text" name="author" id="author" value="" tabindex="2" placeholder="昵称"><span class="text-muted">昵称 (必填)</span></li>
							<li class="form-inline"><label class="hide" for="email">邮箱</label><input class="ipt" type="text" name="email" id="email" value="" tabindex="3" placeholder="邮箱"><span class="text-muted">邮箱 (必填)</span></li>
							<li class="form-inline"><label class="hide" for="url">引用地址</label><input class="ipt" type="text" name="url" id="url" value="" tabindex="4" placeholder="引用地址"><span class="text-muted">引用地址</span></li>
						</ul>
					</div>
				
			
		</div>

	</form>
	</div>
<script type="text/javascript">
$(function() {
	//初始化编辑器
	
	var editor = new Simditor({
	  textarea: $('#mded'),
	  placeholder: '写笔记...',
	  upload:false,
	 // upload: {url:'/api/comment_upload_file.php',params: null,fileKey: 'upload_file',connectionCount: 1,leaveConfirm: '文件正在上传，您确定离开?'},
	  defaultImage: 'https://www.runoob.com/images/logo.png',
	  codeLanguages: '',
	  autosave: 'editor-content',
	  toolbar: [  'bold','code','ul','ol','image' ]
	});
	editor.on('selectionchanged', function() {
		$(".code-popover").hide();
	});

	// 提交数据
	$("#share_code").click(function() {
		$(".comment-signarea").hide();
		$("#commentform").show();
		
	});
	$("#user_add_note").click(function() {
		$(".comment-signarea").hide();
		$("#commentform").show();
		$('html, body').animate({
       	    scrollTop: $("#respond").offset().top
    	}, 200);
	});

	// 提交笔记
	var commentform=$('#commentform');
	commentform.prepend('<div id="comment-status" style="display:none;" ></div>');
	var statusdiv=$('#comment-status');
	
	commentform.submit(function(e){
		e.preventDefault();
		var noteContent = editor.getValue();
		// console.log(noteContent);
		noteContent = noteContent.replace(/<pre><code>/g,"<pre>");
		noteContent = noteContent.replace(/<\/code><\/pre>/g,"</pre>");
		
		// 系列化表单数据
		var comment_parent = 0;
		var is_user_logged_in = $("#is_user_logged_in").val();
		var comment_post_ID =  20404;
		var _wp_unfiltered_html_comment = $("#_wp_unfiltered_html_comment").val();
		var comment = noteContent;
		var author = $("#author").val();
		var url = $("#url").val();
		var email = $("#email").val();
		if(isBlank(author) && is_user_logged_in==0) {
			statusdiv.html('<p  class="ajax-error">请输入昵称！</p>').show();
		} else if(isBlank(email)  && is_user_logged_in==0) {
			statusdiv.html('<p  class="ajax-error">请输入邮箱！</p>').show();
		} else {
			// var formdata=commentform.serialize() + "&comment=" + noteContent ;
			// 添加状态信息
			statusdiv.html('<p>Processing...</p>').show();
			// 获取表单提交地址
			var formurl=commentform.attr('action');
			
			// 异步提交
			$.ajax({
					type: 'post',
					url: formurl,
					dataType:'json',
					data: {"comment_parent":comment_parent,"comment_post_ID":comment_post_ID, "_wp_unfiltered_html_comment":_wp_unfiltered_html_comment,"comment":comment,"url":url, "email":email,"author":author},
					error: function(XMLHttpRequest, textStatus, errorThrown){
					statusdiv.html('<p class="ajax-error" >数据不完整或表单提交太快了！</p>').show();
				},
				success: function(data, textStatus){
					if(data.errorno=="0") {
						$("#submit").prop('disabled', true);
						statusdiv.html('<p class="ajax-success" >笔记已提交审核，感谢分享笔记！</p>').show();
						alert('笔记已提交审核，感谢分享笔记！');
					}else{
						statusdiv.html('<p class="ajax-error" >'+data.msg+'</p>').show();
					}
					commentform.find('textarea[name=comment]').val('');
				}
			});
			setTimeout(function(){
		        $("#submit").prop('disabled', false);
		    }, 10*1000);
		}
		return false;

	});
	$(".comt-author").click(function() {
		href = $(this).children("a").attr("href");
		if(href.indexOf("/note/")!=-1) {
			var win = window.open(href, '_blank');
  			win.focus();
		}
	});
	$(".comt-meta span").hover(function(){
		$(this).children(".tooltip").css({ "opacity": 1, "pointer-events": "auto"});
	},function(){
		$(this).children(".tooltip").removeAttr("style");
	});
	/*
	$(".wrapper i").hover(function(){
		$(this).siblings(".tooltip").css({ "opacity": 1, "pointer-events": "auto"});
	},function(){
		$(this).siblings(".tooltip").css({ "opacity": 0, "pointer-events": "auto"});
	});
	*/
	//Upvote.create('runoobvote-id', {callback: vote_callback});
	var ajaxurl = 'https://www.runoob.com/wp-admin/admin-ajax.php';
	var callback = function(data) {
		//console.log($('#runoobvote-id').upvote('upvoted'));
		//console.log($('#runoobvote-id').upvote('downvoted'));
		//console.log(data);
		_vote_action = data.action;
		id_arr = data.id.split('-');
		um_id= id_arr[2];
		//console.log(um_id);
		
		var re = /^[1-9]+/;
		if (re.test(um_id)) { 
			var ajax_data = {
				_vote_action: _vote_action,
				action: "pinglun_zan",
				um_id: um_id,
				um_action: "ding"
			};
			//console.log(ajax_data);
			$.post(ajaxurl,ajax_data,function(status){
				//if(status.vote_num>999) {
				//	_voteHtml = '<span style="display: block; text-align: center;font-size: 20px; color: #6a737c; margin: 8px 0;">'+kFormatter(status.vote_num) +'</span>';
				//	$("#runoobvote-id-" + um_id + " .count").hide().after(_voteHtml);
				//}
				
			});
		}
	};
	if($('#comments').length && $('.upvotejs').length){
		$('.upvotejs').upvote({id: 20404, callback: callback});
	
		$.post(ajaxurl,{"action":"pinglun_zan","postid":20404},function(data){  
			$(data).each(function(key,value) {
				$("#runoobvote-id-" + value.commid + " .upvote").addClass(value.upvotejs_class);
				$("#runoobvote-id-" + value.commid + " .downvote").addClass(value.downvote_class);
				$("#runoobvote-id-" + value.commid + " .count").text(value.upvote_count);
			})
		},'json');
		
	}
	
	
});
function isBlank(str) {
    return (!str || /^\s*$/.test(str));
}
function kFormatter(num) {
	// return num;
    return Math.abs(num) > 999 ? Math.sign(num)*((Math.abs(num)/1000).toFixed(1)) + 'k' : Math.sign(num)*Math.abs(num)
}

</script>

<link rel="stylesheet" href="../0/qa.css?1.44">
<link rel="stylesheet" type="text/css" href="../0/simditor.min.css" />
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
			<div class="article-heading-ad" id="w3cnote-ad728">
			<script async src=""></script>
			<!-- 移动版 自动调整 -->
			<ins class="adsbygoogle"
			     style="display:inline-block;min-width:300px;max-width:970px;width:100%;height:90px"
			     data-ad-client="ca-pub-5751451760833794"
			     data-ad-slot="1691338467"
			     data-ad-format="horizontal"></ins>
			<script>
			(adsbygoogle = window.adsbygoogle || []).push({});
			</script>
			</div>
			<style>
@media screen and (max-width: 768px) {
	#w3cnote-ad728 {
		display: none;
	}
}
p.note-author {
    border-bottom: 1px solid #ddd;
    font-size: 18px;
    font-weight: bold;
    color: #78a15a;
    padding-bottom: 2px;
    margin-bottom: 4px;
}
</style>
<script>
var aid = 20404;
</script>
	</div>
		
	</div>
	<div class="listcol last right-column">




<!--
	<div class="tab tab-light-blue"> 订阅</div>
	<div class="sidebar-box">
		<div class="socialicons">
			<a href="../feed" class="rss">RSS 订阅</a>
		
			<form action="//list.qq.com/cgi-bin/qf_compose_send" method="post">
			<input type="hidden" value="qf_booked_feedback" name="t">
			<input type="hidden" value="4b67b6b6c1f5e792559940cab4aebb8f1126fba880bff1a8" name="id">
			<input class="placeholder" id="feed_email" name="to" value="输入邮箱 订阅笔记" autocomplete="off">
			<input type="submit" value="订阅" class="btn btn-primary">
			</form>
		
		</div>
 
	</div>
-->	



<!--
	<div class="sidebar-box cate-list">
	<div class="sidebar-box recommend-here list-link">
			<a href="javascript:void(0);" style="font-size: 16px; color:#64854c;font-weight:bold;">笔记列表</a>
		</div>

 

</div>
-->

	 <div class="sidebar-box cate-list">
		 		

	 	<div class="sidebar-box recommend-here list-link">
			<a href="javascript:void(0);" style="font-size: 16px; color:#64854c;font-weight:bold;">教程列表</a>
		</div>
		
		<div class="cate-items"> 
				<a href="../ado">ADO 教程</a>
	<a href="../ajax">Ajax 教程</a>
	<a href="../android">Android 教程</a>
	<a href="../angularjs2">Angular2 教程</a>
	<a href="../angularjs">AngularJS 教程</a>
	<a href="../appml">AppML 教程</a>
	<a href="../asp">ASP 教程</a>
	<a href="../aspnet">ASP.NET 教程</a>
	<a href="../bootstrap">Bootstrap 教程</a>
	<a href="../bootstrap4">Bootstrap4 教程</a>
	<a href="../bootstrap5">Bootstrap5 教程</a>
	<a href="../cprogramming">C 教程</a>
	<a href="../csharp">C# 教程</a>
	<a href="../cplusplus">C++ 教程</a>
	<a href="../chartjs">Chart.js 教程</a>
	<a href="../cssref">CSS 参考手册</a>
	<a href="../css">CSS 教程</a>
	<a href="../css3">CSS3 教程</a>
	<a href="../django">Django 教程</a>
	<a href="../docker">Docker 教程</a>
	<a href="../dtd">DTD 教程</a>
	<a href="../echarts">ECharts 教程</a>
	<a href="../eclipse">Eclipse 教程</a>
	<a href="../firebug">Firebug 教程</a>
	<a href="../font-awesome">Font Awesome 图标</a>
	<a href="../foundation">Foundation 教程</a>
	<a href="../git">Git 教程</a>
	<a href="../go">Go 语言教程</a>
	<a href="../googleapi">Google 地图 API 教程</a>
	<a href="../highcharts">Highcharts 教程</a>
	<a href="../htmldom">HTML DOM 教程</a>
	<a href="../tags">HTML 参考手册</a>
	<a href="../charsets">HTML 字符集</a>
	<a href="../html">HTML 教程</a>
	<a href="../http">HTTP 教程</a>
	<a href="../ionic">ionic 教程</a>
	<a href="../ios">iOS 教程</a>
	<a href="../java">Java 教程</a>
	<a href="../jsref">JavaScript 参考手册</a>
	<a href="../js">Javascript 教程</a>
	<a href="../jeasyui">jQuery EasyUI 教程</a>
	<a href="../jquerymobile">jQuery Mobile 教程</a>
	<a href="../jqueryui">jQuery UI 教程</a>
	<a href="../jquery">jQuery 教程</a>
	<a href="../json">JSON 教程</a>
	<a href="../jsp">JSP 教程</a>
	<a href="../julia">Julia 教程</a>
	<a href="../kotlin">Kotlin 教程</a>
	<a href="../linux">Linux 教程</a>
	<a href="../lua">Lua 教程</a>
	<a href="../markdown">Markdown 教程</a>
	<a href="../matplotlib">Matplotlib 教程</a>
	<a href="../maven">Maven 教程</a>
	<a href="../memcached">Memcached 教程</a>
	<a href="../mongodb">MongoDB 教程</a>
	<a href="../mysql">MySQL 教程</a>
	<a href="../nodejs">Node.js 教程</a>
	<a href="../numpy">NumPy 教程</a>
	<a href="../pandas">Pandas 教程</a>
	<a href="../perl">Perl 教程</a>
	<a href="../php">PHP 教程</a>
	<a href="../postgresql">PostgreSQL 教程</a>
	<a href="../python3">Python 3 教程</a>
	<a href="../python">Python 基础教程</a>
	<a href="../r">R 教程</a>
	<a href="../rdf">RDF 教程</a>
	<a href="../react">React 教程</a>
	<a href="../redis">Redis 教程</a>
	<a href="../rss">RSS 教程</a>
	<a href="../ruby">Ruby 教程</a>
	<a href="../rust">Rust 教程</a>
	<a href="../sass">Sass 教程</a>
	<a href="../scala">Scala 教程</a>
	<a href="../scipy">SciPy 教程</a>
	<a href="../servlet">Servlet 教程</a>
	<a href="../soap">SOAP 教程</a>
	<a href="../sql">SQL 教程</a>
	<a href="../sqlite">SQLite 教程</a>
	<a href="../svg">SVG 教程</a>
	<a href="../svn">SVN 教程</a>
	<a href="../swift">Swift 教程</a>
	<a href="../tcpip">TCP/IP 教程</a>
	<a href="../typescript">TypeScript 教程</a>
	<a href="../vbscript">VBScript 教程</a>
	<a href="../vue2">Vue.js 教程</a>
	<a href="../vue3">Vue3 教程</a>
	<a href="../w3c">W3C 教程</a>
	<a href="../webservices">Web Service 教程</a>
	<a href="../wsdl">WSDL 教程</a>
	<a href="../xlink">XLink 教程</a>
	<a href="../dom">XML DOM 教程</a>
	<a href="../schema">XML Schema 教程</a>
	<a href="../xml">XML 教程</a>
	<a href="../xpath">XPath 教程</a>
	<a href="../xquery">XQuery 教程</a>
	<a href="../xslfo">XSLFO 教程</a>
	<a href="../xsl">XSLT 教程</a>
	<a href="../data-structures">数据结构</a>
	<a href="../regexp">正则表达式</a>
	<a href="../quiz">测验</a>
	<a href="../browsers">浏览器</a>
	<a href="../quality">网站品质</a>
	<a href="../web">网站建设指南</a>
	<a href="../hosting">网站服务器教程</a>
	<a href="../design-pattern">设计模式</a>
			
		</div> 
		 	 </div>
</div>
	</div>
</div>


<!-- 底部 -->
<div id="footer" class="mar-t50">
   <div class="runoob-block">
    <div class="runoob cf">
     <dl>
      <dt>
       在线实例
      </dt>
      <dd>
       &middot;<a target="_blank" href="../html/html-examples.html">HTML 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../css/css-examples.html">CSS 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../js/js-examples.html">JavaScript 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../ajx/ajax-examples.html">Ajax 实例</a>
      </dd>
       <dd>
       &middot;<a target="_blank" href="../jquery/jquery-examples.html">jQuery 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../xml/xml-examples.html">XML 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../java/java-examples.html">Java 实例</a>
      </dd>
     
     </dl>
     <dl>
      <dt>
      字符集&工具
      </dt>
      <dd>
       &middot; <a target="_blank" href="../charsets/html-charsets.html">HTML 字符集设置</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="../tags/html-ascii.html">HTML ASCII 字符集</a>
      </dd>
     <dd>
       &middot; <a target="_blank" href="https://c.runoob.com/front-end/6939/">JS 混淆/加密</a>
      </dd> 
      <dd>
       &middot; <a target="_blank" href="https://c.runoob.com/front-end/6232/">PNG/JPEG 图片压缩</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="../tags/html-colorpicker.html">HTML 拾色器</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="..//c.runoob.com/front-end/53">JSON 格式化工具</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="..//c.runoob.com/front-end/6680/">随机数生成器</a>
      </dd>
     </dl>
     <dl>
      <dt>
       最新更新
      </dt>
                   <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imread.html" title="Matplotlib imread() 方法">Matplotlib imre...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imsave.html" title="Matplotlib imsave() 方法">Matplotlib imsa...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imshow.html" title="Matplotlib imshow() 方法">Matplotlib imsh...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-hist.html" title="Matplotlib 直方图">Matplotlib 直方图</a>
      </dd>
              <dd>
       &middot;
      <a href="../python3/python-func-object.html" title="Python object() 函数">Python object()...</a>
      </dd>
              <dd>
       &middot;
      <a href="../python3/python-ai-draw.html" title="Python AI 绘画">Python AI 绘画</a>
      </dd>
              <dd>
       &middot;
      <a href="../w3cnote/cursor-editor.html" title="神辅助 Cursor 编辑器，加入 GPT-4 让编码更轻松！">神辅助 Cursor ...</a>
      </dd>
             </dl>
     <dl>
      <dt>
       站点信息
      </dt>
      <dd>
       &middot;
       <a target="_blank" href="mailto:admin@runoob.com" rel="external nofollow">意见反馈</a>
       </dd>
      <dd>
       &middot;
      <a target="_blank" href="../disclaimer">免责声明</a>
       </dd>
      <dd>
       &middot;
       <a target="_blank" href="../aboutus">关于我们</a>
       </dd>
      <dd>
       &middot;
      <a target="_blank" href="../archives">文章归档</a>
      </dd>
    
     </dl>
    
     <div class="search-share">
      <div class="app-download">
        <div>
         <strong>关注微信</strong>
        </div>
      </div>
      <div class="share">
      <img width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png" />
       </div>
     </div>
     
    </div>
   </div>
   <div class="w-1000 copyright">
     Copyright &copy; 2013-2023    <strong><a href="../" target="_blank">菜鸟教程</a></strong>&nbsp;
    <strong><a href="../" target="_blank">runoob.com</a></strong> All Rights Reserved. 备案号：<a target="_blank" rel="nofollow" href="https://beian.miit.gov.cn/">闽ICP备15012807号-1</a>
   </div>
  </div>
  <div class="fixed-btn">
    <a class="go-top" href="javascript:void(0)" title="返回顶部"> <i class="fa fa-angle-up"></i></a>
    <a class="qrcode"  href="javascript:void(0)" title="关注我们"><i class="fa fa-qrcode"></i></a>
    <a class="writer" style="display:none" href="javascript:void(0)"   title="标记/收藏"><i class="fa fa-star" aria-hidden="true"></i></a>
    <!-- qrcode modal -->
    <div id="bottom-qrcode" class="modal panel-modal hide fade in">
      <h4>微信关注</h4>
      <div class="panel-body"><img alt="微信关注" width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png"></div> 
    </div>
  </div>

 <div style="display:none;">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-84264393-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-84264393-2');
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?3eec0b7da6548cf07db3bc477ea905ee";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</div>
<script>
window.jsui={
    www: 'https://www.runoob.com',
    uri: 'https://www.runoob.com/wp-content/themes/runoob'
};
</script>

<script src=""></script>
<script src=""></script>

</body>
</html>